package com.imdroid.logic;

import java.util.Collection;

import net.orange.architecture.process.IBaseProcess;

import com.imdroid.modal.Device;

/**
 * The process interface of IMDroid devices
 * 
 */
public interface IDeviceProcess extends IBaseProcess {
	/**
	 * Get the device by user id
	 * 
	 * @param user_id
	 *            the id of user
	 * @return the object of devices
	 * @throws Exception
	 */
	public Device getDeviceByUserId(int user_id) throws Exception;

	/**
	 * Get device by IMEI number
	 * 
	 * @param IMEI
	 *            the IMEI number
	 * @return the target user
	 * @throws Exception
	 */
	public Device getDeviceByIMEI(String IMEI) throws Exception;

	/**
	 * Get device by User Name
	 * 
	 * @param user_name
	 *            the User Name
	 * @return the target user
	 * @throws Exception
	 */
	public Device getDeviceByUserName(String user_name) throws Exception;



	/**
	 * Search the device by nick name
	 * 
	 * @param nickname
	 *            the nick name
	 * @return the target customer
	 * @throws Exception
	 */
	public Device getDeviceByNickname(String nickname) throws Exception;

	/**
	 * Get device by User Name
	 * 
	 * @param user_name
	 *            the User Name
	 * @param type
	 *            the Device type
	 * @return the target user
	 * @throws Exception
	 */
	public Device getDeviceByMobile(String mobile_phone, int type)
			throws Exception;

	/**
	 * Get device by parentId
	 * 
	 * @param type
	 *            the parent device id
	 * @return the target user
	 * @throws Exception
	 */
	public Device getDeviceByParent(int parentId) throws Exception;

	/**
	 * Search the device
	 * 
	 * @param keywork
	 *            the keyword
	 * @param userId
	 *            the id of user who make the search
	 * @return the list of users
	 * @throws Exception
	 */
	public Collection searchUser(String keywork, int userId) throws Exception;

	/**
	 * Search the team
	 * 
	 * @param keywork
	 *            the keyword
	 * @param userId
	 *            the id of user who make the search
	 * @return the list of users
	 * @throws Exception
	 */
	public Collection searchTeam(String keywork, int userId) throws Exception;

	/**
	 * Get the target user by user name and password
	 * 
	 * @param userName
	 *            the user name
	 * @param password
	 *            the password
	 * @return the target user
	 * @throws Exception
	 */
	public Device getUserByUserNameAndPwd(String userName, String password)
			throws Exception;

	/**
	 * update the device location
	 * 
	 * @param IMEI
	 *            the IMEI of the device
	 * @param lat
	 *            the GPS lat
	 * @param lon
	 *            the GPS lon
	 */
	public void updateLocation(String IMEI, float lat, float lon,
			long start_time) throws Exception;

}
